package eerbaar.v2.graphics.rect;

import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;

@SuppressWarnings("serial")
public class Rectangle2 extends Rectangle {

    public Rectangle2(int x, int y, int width, int height) {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
    }

    public Rectangle2(Point point, Dimension size) {
        this.x = point.x;
        this.y = point.y;
        this.width = size.width;
        this.height = size.height;
    }

    public Rectangle2(Rectangle r) {
        this.x = r.x;
        this.y = r.y;
        this.width = r.width;
        this.height = r.height;
    }

    public Point getBottomLeft() {
        return new Point(this.x, this.y + this.height);
    }

    public Point getBottomRight() {
        return new Point(this.x + this.width, this.y + this.height);
    }

    public Point getCenter() {
        int x = this.x + (this.width / 2);
        int y = this.y + (this.height / 2);
        return new Point(x, y);
    }

    public int getLeft() {
        return this.x;
    }

    public Rectangle getRectangle() {
        return new Rectangle(this.x, this.y, this.width, this.height);
    }

    public int getTop() {
        return this.y;
    }

    public Point getTopLeft() {
        return new Point(this.x, this.y);
    }

    public Point getTopRight() {
        return new Point(this.x + this.width, this.y);
    }

}
